package cos.android.tim.objects;

import java.util.Vector;

import android.graphics.Bitmap;
import cos.android.tim.element.Element;
import cos.android.tim.element.Polygon;
import cos.android.tim.utils.Point;

public class Rampa extends Element {

	private float m;
	private int orientation;

	public Rampa(Bitmap sprite, Bitmap colisionSprite, Bitmap minisprite,
			int xPos, int yPos, float m, String kind, int orientation) {
		super(sprite, colisionSprite, minisprite, xPos, yPos, kind);
		this.orientation = orientation;
		refreshAristas();

		this.m = m;
		if (m < 0) {

		}
	}

	public float getM() {
		return m;
	}

	public void setM(float m) {
		this.m = m;
	}

	@Override
	public void refreshAristas() {
		Vector<Point> aristas = new Vector<Point>();

		if (orientation == 0) {
			aristas.add(new Point(0, 0));
			aristas.add(new Point(getWidth(), getHeight() / 2));
			aristas.add(new Point(getWidth(), getHeight()));
			aristas.add(new Point(0, getHeight() / 2));
			aristas.add(new Point(0, 0));
		} else {
			aristas.add(new Point(0, getHeight() / 2));
			aristas.add(new Point(getWidth(), 0));
			aristas.add(new Point(getWidth(), getHeight() / 2));
			aristas.add(new Point(0, getHeight()));
			aristas.add(new Point(0, getHeight() / 2));
		}
		this.setPolygon(new Polygon(aristas));
	}
}
